0c2cee7000d7886ed3043a5f35b2e0da4dac9146,bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ModelAdapterFactory.java,ModelAdapterFactory,setMethod,#Method#Map#Object#,809
Before Change
private static boolean setMethod(Method method, Map<Method, Object> methods, Object value) {
if (value != null) {
if (!isAcceptableType(method.getReturnType(), method.getGenericReturnType(), value) && value instanceof Adaptable) {
value = ((Adaptable) value).adaptTo(method.getReturnType());
if (value == null) {
return false;
}
After Change
private static boolean setMethod(Method method, Map<Method, Object> methods, Object value) {
if (value != null) {
value = adaptIfNecessary(value, method.getReturnType(), method.getGenericReturnType());
// value may now be null due to the adaptation done above
if (value == null) {
return false;